// Default variables
$header-background-color: #fff !default;
$header-links-color: #828ba0 !default;
$header-links-background-color: #fff !default;
$header-links-color-active: #333 !default;
$header-icon-color: $header-links-color !default;
$header-icon-color-hover: $secondary !default;
$header-icon-border-color-hover: $secondary !default;
$header-toggler-icon: "data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='#{transparentize($primary, 0.5)}' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E" !default;
$header-textfield-text-color: $header-links-color !default;
$header-textfield-background-color: #f5f6fa !default;
$header-textfield-magnifier-color: $header-links-color !default;
$header-link-horizontal-padding: 0.71rem;
$navbar-logo-height: auto !default;
$navbar-logo-width: auto !default;
$header-logo-text-color: #333 !default;

.navbar.navbar-primary {
  background-color: $header-background-color;
  position: relative;
  z-index: 100;

  .nav-item {
    font-size: 14px;
  }

  .navbar-nav {

    .nav-submenu {
      padding: 10px 20px;
      color: $header-links-color;
      background-color: $header-links-background-color;
    }
    
    .nav-link {
      outline: none;
      align-items: center;
      color: $header-links-color;
      display: flex;
      font-size: 14px;
      position: relative;
      transition: $transition-cont;

      &:before {
        background-color: $header-icon-border-color-hover;
        border-radius: 0 0 4px 4px;
        content: "";
        display: block;
        height: 0.25rem;
        left: 50%;
        opacity: 0;
        position: absolute;
        top: -10px;
        transform: translateX(-50%);
        transition: $transition-cont;
        width: calc(
          100% - #{$header-link-horizontal-padding} - #{$header-link-horizontal-padding}
        );
      }

      &.active,
      &:hover {
        @include media-breakpoint-up(lg) {
          &:before {
            opacity: 1;
          }
        }
      }

      &.active,
      &:hover,
      &.active-icon {
        color: $header-links-color-active;
        .nav-link-icon {
          path {
            fill: $header-icon-color-hover;
          }
        }
      }

      .nav-link-icon {
        align-items: center;
        display: flex;
        margin-right: 0.71em;
        position: relative;
        top: -1px;

        path {
          fill: $header-icon-color;
          transition: $transition-cont;
        }
      }
    }

    .nav-item-networks {
      margin-left: auto;
      .nav-link:before {
        display: none;
      }
    }
  }

  .navbar-toggler {
    outline: none;
    color: $primary;
    padding-right: 0px;

    .navbar-toggler-icon {
      background-image: url($header-toggler-icon);
    }
  }
  .search-form {
    display: flex;

    @include media-breakpoint-up(xl) {
      height: 57px;
      margin-bottom: -8px;
      margin-top: -8px;
    }
  }

  .form-inline {
    height: 100%;
  }

  .input-group {
    height: 100%;
    position: relative;
  }

  .form-control {
    background: $header-textfield-background-color;
    border-color: $header-textfield-background-color;
    color: $header-textfield-text-color;
    font-size: 14px;
    height: 100%;
    padding-left: 38px;
    padding-right: 8px;
    position: relative;
    width: 100%;
    z-index: 1;

    &[placeholder]{
      text-overflow: ellipsis !important;
    }
    &::-webkit-input-placeholder { /* Chrome/Opera/Safari */
        text-overflow: ellipsis  !important;
    }
    &::-moz-placeholder { /* Firefox 19+ */
        text-overflow: ellipsis  !important;
    }
    &:-ms-input-placeholder { /* IE 10+ */
        text-overflow: ellipsis  !important;
    }
    &:-moz-placeholder { /* Firefox 18- */
        text-overflow: ellipsis  !important;
    }

    &:focus {
      box-shadow: none;
    }

    @include media-breakpoint-up(xl) {
      width: 290px;
    }
    @media (min-width: 1366px) {
      width: 380px;
    }
    @media (min-width: 1540px) {
      width: 550px;
    }
  }
  .input-group-append {
    height: 38px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    z-index: 5;

    &.left {
      left: 0px;
    }

    &.right {
      right: 8px;
      width: 25px;
      height: 25px;
    }

    &.desktop-only {
      @include media-breakpoint-down(md) {
        display: none;
      }
    }

    * {
      fill: $header-textfield-magnifier-color;
    }
  }
  .input-group-text {
    align-items: center;
    background: none;
    border-color: transparent;
    display: flex;
    height: 100%;
    justify-content: center;
    padding: 0;
    width: 100%;

    &.border {
      border-color: $secondary !important;
      border-radius: 5px;
      color: $secondary;
      background-color: $header-textfield-background-color;
    }
  }
}

.navbar-collapse.collapsing,
.navbar-collapse.collapse.show {
  display: flex;
  flex-direction: column;

  .search-form {
    align-items: center;
    order: -1;
    width: 100%;

    form {
      flex-grow: 1;
    }

  }
  .input-group {
    width: 100%;
  }
  .navbar-nav {
    white-space: nowrap;
  }
}

.navbar-brand {
  margin-left: 0;
  flex-shrink: 1;
  display: inline-flex;
  .navbar-logo {
    max-width: 100%;
  }
}

.navbar-logo {
  max-height: $navbar-logo-height;
  width: $navbar-logo-width;
}

.logo-text {
  color: $header-logo-text-color;
  font-size: 1rem;
  font-weight: 700;
  margin-left: 5px;
  line-height: 28px;

  &.in-footer {
    color: #fff;
  }

  &.no-logo {
    margin-left: 0px;
  }
}

@include media-breakpoint-up(md) {
  .navbar-expand-lg .navbar-nav .nav-link {
    padding-left: $header-link-horizontal-padding;
    padding-right: $header-link-horizontal-padding;
  }
}

.add-border {
  border: 1px solid transparentize($white, 0.30);
}

.navbar-collapse {
  justify-content: flex-end;
  align-items: flex-start;
  flex-shrink: 0;
  @media (min-width: 992px) {
    align-items: center;
  }
}

.navbar-container, .navbar-primary {
  @media (min-width: 992px) {
    padding-right: 0;
  }
}

.nav-item-networks {
  .topnav-nav-link {
    transition: none !important;
  }
}

.visually-hidden {
  display: block;
}